import React, { Component, ElementType } from 'react'
import { EmployeeResponse } from '../../interface/employee'
import { Table } from 'antd'

import QueryForm from './QueryForm'
import { employeeColumns } from './colums'

interface State {
  employee: EmployeeResponse
}

export default class Employee extends Component<{}, State> {
  state: State = {
    employee: undefined
  }

  setEmployee (employee: EmployeeResponse) {
    this.setState({ employee })
  }


  render () {
    return (
      <>
        <QueryForm onDataChange={ this.setEmployee.bind(this) }></QueryForm>
        <Table columns={employeeColumns} dataSource={this.state.employee} className="table"/>
      </>
    )
  }
}